package com.mce.nebula.dto;

import com.mce.nebula.entity.TeamUser;
import com.mce.nebula.entity.User;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 团队成员响应DTO
 */
@Data
public class TeamUserResponse {
    
    private Long id;
    private String tenantId;
    private Integer userId;
    private String identity;
    private Boolean isActive;
    private String enterpriseId;
    private LocalDateTime createTime;
    private LocalDateTime updateTime;
    
    // 用户信息
    private String userName;
    private String userEmail;
    private String userRealName;
    private String userPhone;
    
    public TeamUserResponse(TeamUser teamUser) {
        this.id = teamUser.getId();
        this.tenantId = teamUser.getTenantId();
        this.userId = teamUser.getUserId();
        this.identity = teamUser.getIdentity();
        this.isActive = teamUser.getIsActive();
        this.enterpriseId = teamUser.getEnterpriseId();
        this.createTime = teamUser.getCreateTime();
        this.updateTime = teamUser.getUpdateTime();
    }
    
    public TeamUserResponse(TeamUser teamUser, User user) {
        this(teamUser);
        if (user != null) {
            this.userName = user.getNickName();
            this.userEmail = user.getEmail();
            this.userRealName = user.getRealName();
            this.userPhone = user.getPhone();
        }
    }
}





